﻿using System;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using Fuse8.ContentManagementFramework.SystemFacade.Globalization;

namespace Fuse8.ContentManagementFramework.Administration.Attributes
{
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
    public class GlobalizedRequiredAttribute : RequiredAttribute
    {
        public GlobalizedRequiredAttribute(string name, string domain)
        {
            ErrorMessage = GlobalizationFacade.Current.WithDomain(domain, CultureInfo.CurrentUICulture).GetText(name);
        }        
    }
}